﻿package mortal.game.view.guide.guideUse
{
    import extend.language.*;
    import flash.events.*;
    import flash.geom.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.cache.packCache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuideWizardEquipWin extends GuideSpecialEquipUseWin
    {
        private var _packPos:WizardPackCache;

        public function GuideWizardEquipWin(param1:ILayer = null)
        {
            super(param1);
            return;
        }// end function

        override protected function updateData() : void
        {
            var _loc_1:int = 0;
            _txtName.htmlText = _itemData.itemInfo.htmlName;
            var _loc_2:int = 0;
            this._packPos = Cache.instance.pack.getWizardPackCacheByCode(_itemData.itemInfo.effectEx);
            _myEquip = this._packPos.getEquipByType(_itemData.itemInfo.type);
            if (_myEquip != null)
            {
                _loc_2 = MountUtil.getMountEquipCombatByItemData(_myEquip);
                _txtEquipName.htmlText = Language.getStringByParam(20999, ItemsUtil.getItemWholeName(_myEquip, true));
            }
            else
            {
                _txtEquipName.htmlText = Language.getStringByParam(20999, Language.getString(21000));
            }
            _loc_1 = MountUtil.getMountEquipCombatByItemData(_itemData);
            if (_myEquip != null && _loc_1 > _loc_2)
            {
                _txtAdd.text = (_loc_1 - _loc_2).toString();
                _txtDesc.text = Language.getString(21003);
            }
            else
            {
                _txtAdd.text = _loc_1.toString();
                _txtDesc.text = Language.getString(21005);
            }
            _item.updateStrengLevel(_itemData.itemInfo.itemLevel);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._packPos = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override protected function useItemHandler(event:MouseEvent) : void
        {
            var _loc_2:* = new Object();
            _loc_2.putonitemData = _itemData;
            _loc_2.getoffItemData = this._packPos.getEquipByType(_itemData.itemInfo.type);
            _loc_2.code = _itemData.itemInfo.effectEx;
            Dispatcher.dispatchEvent(new DataEvent(EventName.WizardEquip, _loc_2));
            var _loc_3:* = _item.localToGlobal(GameConst.yellowPoint);
            FlyToNavbarTool.flyBitmapOriginalToPack(_item.bitmapdata, _loc_3, ModuleType.Wizard);
            this.hide();
            return;
        }// end function

    }
}
